package course.p11_graph.s1_disjointSet;

public class DisjointSetTest {

    private static final int VERTICES = 6;

    public static void main(String[] args) {

        int[] parent = new int[VERTICES];

        int[][] param = {{0,1},{1,2},{1,3},{3,4},{2,5}};

        DisjointSet disjointSet = new DisjointSet();
        disjointSet.init(parent);
        for(int i=0;i<5;i++) {
            int x = param[i][0];
            int y = param[i][1];
            if(disjointSet.isUnion(x,y,parent)==0){
                System.out.println("存在环！！");
                return;
            }
        }
        System.out.println("不存在环！！");
    }
}
